using System.IO;
using Pronghorn.Core;

namespace TestDoubles
{
	public class StubSkinParser : ISkinParser
	{
		public void Parse(TextWriter writer)
		{
			writer.Write(
                @"writer.Write(""<!DOCTYPE HTML PUBLIC \""-//W3C//DTD HTML 4.0 Transitional//EN\"">"");
            writer.Write(""<html>"");
            writer.Write(""    <head>"");
            writer.Write(string.Format(""        <title>{0}</title>"", Model.PageTitle));
            RenderCollection(Model.GetMetaTags(), writer);
			RenderCss(writer);
			RenderScripts(writer);
            writer.Write(""    </head>"");
            writer.Write(""    <body>"");
            var scenes = Model.Data.GetIEnumerable(""scenes"");
            if (scenes != null)
            {
                foreach (var scene in scenes)
                {
                    writer.Write(string.Format(""     <img src=\""{0}\"" title=\""{1}\"" border=\""0\""/>"", Model.Data.GetString(""scene.src""), Model.Data.GetString(""scene.title"")));
                }
            }
            writer.Write(""        <div class=\""className\"" onClick=\""alert('my name here');\"">"");
            writer.Write(""            <div>"");
            var arealeftnavbar = Model.Areas.FirstOrDefault(a => a.Name.ToLower() == ""leftnavbar"");
            RenderCollection((IList<IRenderable>) arealeftnavbar.Layout, writer);
            writer.Write(""            </div>"");
            writer.Write(""            <div>"");
            var areacontent = Model.Areas.FirstOrDefault(a => a.Name.ToLower() == ""content"");
            RenderCollection((IList<IRenderable>) areacontent.Layout, writer);
            writer.Write(""            </div>"");
            writer.Write(""            <div>"");
            var arearightnavbar = Model.Areas.FirstOrDefault(a => a.Name.ToLower() == ""rightnavbar"");
            RenderCollection((IList<IRenderable>) arearightnavbar.Layout, writer);
            writer.Write(""            </div>"");
            writer.Write(""        </div>"");
            writer.Write(""    </body>"");
            writer.Write(""</html>"");");
		}
	}
}